//
//  SEGScreenSupportRotateDelegate.m
//  SEGWorkOrderTest
//
//  Created by Clavis on 2019/4/1.
//  Copyright © 2019 Clavis. All rights reserved.
//

#import "SEGScreenSupportRotateDelegate.h"

#if __has_include(<Commom/EXTConcreteProtocol.h>)
#import <Commom/EXTConcreteProtocol.h>
#else
#import "EXTConcreteProtocol.h"
#endif

@concreteprotocol(SEGScreenSupportRotateDelegate)

- (BOOL)isForceLandscape {
    return [objc_getAssociatedObject(self, _cmd) boolValue];
}

- (void)setIsForceLandscape:(BOOL)isForceLandscape {
    objc_setAssociatedObject(self, @selector(isForceLandscape), @(isForceLandscape), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

#pragma mark - ================<强制横竖屏操作>===============
/**
 强制横竖屏操作
 */
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    if (self.isForceLandscape) {
        //向右横屏
        return UIInterfaceOrientationMaskLandscapeRight;
    }
    //默认竖屏
    return UIInterfaceOrientationMaskPortrait;
}

@end
